home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Jugar con las fuentes / Bricks / Bricks.cs next >
Encoding:
Text File  |  2002-05-09  |  952 b   |  31 lines

  1. //-------------------------------------
  2. // Bricks.cs ⌐ 2001 by Charles Petzold
  3. //-------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8.  
  9. class Bricks: FontMenuForm
  10. {
  11.      public new static void Main()
  12.      {
  13.           Application.Run(new Bricks());
  14.      }
  15.      public Bricks()
  16.      {
  17.           Text = "Ladrillos";
  18.  
  19.           strText = "Ladrillos";
  20.           font = new Font("Times New Roman", 144);
  21.      }
  22.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  23.      {
  24.           SizeF sizef  = grfx.MeasureString(strText, font);
  25.           Brush hbrush = new HatchBrush(HatchStyle.HorizontalBrick,
  26.                                         Color.White, Color.Black);
  27.  
  28.           grfx.DrawString(strText, font, hbrush, (cx - sizef.Width) / 2,
  29.                                                  (cy - sizef.Height) / 2);
  30.      }
  31. }